Skip to content

perf(studio): 32 kB gzip of initial-load headroom - #89

Merged
Madraka merged 1 commit into
mainfrom
perf/studio-entry-headroom
Oct 22, 2026
Merged

Madraka merged 1 commit into
mainfrom
perf/studio-entry-headroom

Conversation

@Madraka

@Madraka Madraka commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Studio's initial load was at 419.9 / 420 kB gzip; it is now 387.6 kB, with no behaviour change.

Cause: Rolldown keeps a module whole in its shared chunk. The shell imported small hooks from big modules (SiteShell → useTaxonomyData; useNotifications → Elevation/ElevationRequest → AgentModes; the bell's item components), which pulled each whole module and its imports into the initial load.

Changes

  • The bell's item list (NotificationItems.tsx) is React.lazy, prefetched as soon as a notification exists. The empty state, toasts and browser notifications are unchanged.
  • Small hooks moved to their own modules: elevation-actions.ts, useShortDuration.ts, taxonomy-keys.ts. They are still implemented once and re-exported where they were.
  • bundle-budget.ts: new LAZY_ONLY guards (NotificationItems, AgentModes, Elevation, ElevationRequest, Taxonomy, RelativeTime, lib/taxonomy, lib/seo, lib/activity). The budget stays at 420 kB, so the room is kept for shell features.
Before After
Initial load (gzip) 419.9 kB 387.6 kB
Chunks in the initial load 94 72
Entry (minified) 199.4 kB 201.6 kB (budget 240)

Checks: Studio 1204/1204; typecheck, design lint (363 files) and size pass; the vite build budget passes. Screenshots of the shell, the ⌘K palette and the bell panel at 1440 and 390 px show no console errors and no sideways scroll.

Not taken yet: moving route-only blocks of en.ts into lazy namespaces (about 10 kB more), and a lazy SitePublish dialog.

🤖 Generated with Claude Code

The initial load was at 419.9 of 420 kB gzip. Rolldown keeps a module
whole in its shared chunk, so a shell import of one small hook pulled in
the whole module and its imports: SiteShell → useTaxonomyData,
useNotifications → Elevation / ElevationRequest → AgentModes, and the
bell panel's item components.

- The bell's item list (NotificationItems.tsx) loads lazily, fetched as
  soon as a notification exists.
- Small hooks move to their own modules: elevation-actions.ts,
  useShortDuration.ts, taxonomy-keys.ts (re-exported where they were).
- bundle-budget.ts: LAZY_ONLY guards so they cannot creep back.

Initial load 419.9 → 387.6 kB gzip (72 chunks instead of 94); the entry
stays under its budget. Studio 1204/1204; screenshots of the shell, the
⌘K palette and the bell at 1440 and 390 px pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Madraka <[email protected]>
@Madraka
Madraka merged commit 40d3096 into main Oct 22, 2026
4 checks passed
@Madraka
Madraka deleted the perf/studio-entry-headroom branch October 22, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant